<template>
	<view>
	<zh-card :width="620">
		<template v-slot:title>
			<view style="border-left: 10rpx solid #2f54eb;">
				<zh-text  :fontSize="36" class="text-weight-b pl-10" :label="form.enrollFlag?'报名公办信息':'报名信息'"></zh-text>
			</view >
		</template>
		<template v-slot:content>
			<zh-form-desc  field="schoolName"  v-model="form.schoolName" label="报名学校" required  :disabled="true" :transprent="true"></zh-form-desc>
			<zh-form-select  v-if="(data.configTypeDict&&data.configTypeDict.length>1)||data.schoolInfo.schoolNature!=='0'" :disabled="data.specialFlag==='1'" field="configTypeName" @confirm="configTypeChange" :fieldNames="{ label: 'configTypeName', value: 'configTypeName', children: 'children' }" :rules="[{required:true,message:'请选择报名大类'}]" placeholder="请选择报名大类" :showClear="false" v-model="form.configTypeName" :options="data.configTypeDict" :label="data.schoolInfo.schoolNature==='0'?'报名大类':'报名类别'" required  :transprent="true"></zh-form-select>
			<zh-sheet :round="3" v-if="data.configTypeDict.length<=0"  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
				<zh-text  label="报名类别未配置，不能报名，如有疑问，请联系学校"></zh-text>
			</zh-sheet>
			<view v-if="!form.qbFlag">
				<zh-form-item v-if="data.schoolInfo.schoolNature==='0'&&form.configTypeName&&data.showForm&&data.selectFormDictData.length===1" label="报名类别"   :required="true" :transprent="true"> 
					<view class="flex-row-center-end" style="width: 100%" >
						<zh-tag :followTheme="false" :color="getColor()" size="n" :label="form.formName"></zh-tag>
					</view>
				</zh-form-item>
				<zh-form-select v-if="data.schoolInfo.schoolNature==='0'&&form.configTypeName&&data.showForm&&data.selectFormDictData.length>1" @confirm="formChange"  field="formId" :fieldNames="{ label: 'formName', value: 'formId', children: 'children' }" :rules="[{required:true,message:'请选择报名类别'}]" placeholder="请选择报名类别" v-model="form.formId"  :showClear="false" :options="data.selectFormDictData" label="报名类别" required  :transprent="true"></zh-form-select>
				<zh-sheet :round="3" v-if="data.schoolInfo.schoolNature==='0'&&form.configTypeName&&data.showForm&&data.selectFormDictData.length<=0"  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您的条件不符合学校的招生条件，如有疑问，请致电学校了解情况"></zh-text>
				</zh-sheet>
				<zh-form-item v-if="data.showFlag" :label="item.property"   :required="item.requiredFlag==='1'" :layout="(item.propertyType === '11'||item.propertyType === '3')?'vertical':''"  v-for="(item,index) in data.fieldList" :key="index" :desc="item.description" :maxFile="item.max">
					<zh-input v-if="item.propertyType === '1'" v-model="item.value" showClear></zh-input>
					<zh-input v-if="item.propertyType === '11'" v-model="item.value" type="textarea" showClear></zh-input>
					<zh-datetime  v-if="item.propertyType === '2'" placeholder="请输入日期" v-model="item.value"  showClear model="day" :transprent="true"></zh-datetime>
					<template v-if="item.propertyType === '3'" v-slot:labelRight>
						<view class="flex-row-center-end">
						<zh-text color="blue" :label="getUploadCount(item)"></zh-text>
						<zh-text label="/"></zh-text>
						<zh-text :label="item.max||9"></zh-text>
						</view>
					</template>
					<zh-upload
						v-if="item.propertyType === '3'"
						v-model="item.value"
						:fileType="['image']"
						:rows="3"
						:maxFile="item.max||9"
						:width="620"
					>
					</zh-upload>
					<zh-text style="padding:5rpx 0" v-if="item.propertyType === '3'&&item.defaultPhotos" color="blue" :label="item.property+'示例'"></zh-text>
					<zh-image-group v-if="item.propertyType === '3'&&item.defaultPhotos">
						<zh-image :padding="[2,2]" preview :width="190" :height="156" :src="url"  v-for="url in item.defaultPhotoList" :key="url"></zh-image>
					</zh-image-group>
				</zh-form-item>
			</view>
		</template>
	</zh-card>
	<view v-if="!form.qbFlag">
		<zh-card :width="620" v-if="data.hjFlag">
			<template v-slot:title>
				<view style="border-left: 10rpx solid #2f54eb;">
					<zh-text  :fontSize="36" class="text-weight-b pl-10" label="户籍信息"></zh-text>
				</view >
			</template>
			<template v-slot:content>
				<view v-if="form.houseHoldVO&&form.houseHoldVO.address" >
					<zh-form-desc  field="householdAddress"  v-model="form.houseHoldVO.address" label="户籍地址"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="relation"   v-model="form.houseHoldVO.relation" label="与户主关系"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="accountType"  v-model="form.houseHoldVO.accountType" label="户口类型"   :transprent="true"></zh-form-desc>
				</view>
				<zh-sheet :round="3" v-else  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您的孩子在该学区无户籍信息"></zh-text>
				</zh-sheet>
			</template>
		</zh-card>
		<zh-card :width="620" v-if="data.fcFlag">
			<template v-slot:title>
				<view style="border-left: 10rpx solid #2f54eb;">
					<zh-text  :fontSize="36" class="text-weight-b pl-10" label="房产信息"></zh-text>
				</view >
			</template>
			<template v-slot:status>
				<zh-tag v-if="data.beforeList&&data.beforeList.length>1" size="n" label="切换" @click="onChangeFc" ></zh-tag>
			</template>
			<template v-slot:content>
				<view v-if="data.houseInfo&&data.houseInfo.address" >
					<zh-form-desc  field="address"  v-model="data.houseInfo.address" label="房产地址"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="realProperty" v-model="data.houseInfo.realProperty" label="不动产权证号"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="registerDate" v-model="data.houseInfo.registerDate" label="登记时间"   :transprent="true"></zh-form-desc>
				</view>
				<zh-sheet :round="3" v-else  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您的孩子在该学区无房产信息"></zh-text>
				</zh-sheet>
				
			</template>
		</zh-card>
		<zh-card :width="620" v-if="data.fcDsjFlag">
			<template v-slot:title>
				<view style="border-left: 10rpx solid #2f54eb;">
					<zh-text  :fontSize="36" class="text-weight-b pl-10" label="房产信息"></zh-text>
				</view >
			</template>
			<template v-slot:status>
				<zh-tag v-if="form.houseList&&form.houseList.length>1" size="n" label="切换" @click="onChangeFcDsj" ></zh-tag>
			</template>
			<template v-slot:content>
				<view v-if="data.houseInfo&&data.houseInfo.address" >
					<zh-form-desc  field="address"  v-model="data.houseInfo.address" label="房产地址"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="realProperty" v-model="data.houseInfo.realProperty" label="不动产权证号"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="registerDate" v-model="data.houseInfo.registerDate" label="登记时间"   :transprent="true"></zh-form-desc>
				</view>
				<zh-sheet :round="3" v-else  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您的孩子在该学区无房产信息"></zh-text>
				</zh-sheet>
				
			</template>
		</zh-card>
		<zh-card :width="620" v-if="data.wqFlag">
			<template v-slot:title>
				<view style="border-left: 10rpx solid #2f54eb;">
					<zh-text  :fontSize="36" class="text-weight-b pl-10" label="网签(购房合同)信息"></zh-text>
				</view >
			</template>
			<template v-slot:status>
				<zh-tag v-if="form.wqList&&form.wqList.length>1" size="n" label="切换" @click="onChangeWq" ></zh-tag>
			</template>
			<template v-slot:content>
				<view v-if="form.wqList&&form.wqList.length>0">
				<zh-form-desc  field="dz" placeholder="未获取到地址"  v-model="form.wqList[data.wqIndex].dz" label="地址"   :transprent="true"></zh-form-desc>
				<zh-form-desc  field="basj" placeholder="未获取到备案时间"  v-model="form.wqList[data.wqIndex].basj" label="备案时间"   :transprent="true"></zh-form-desc>
				<zh-form-desc  field="htbabh" placeholder="未获取到备案合同号"  v-model="form.wqList[data.wqIndex].htbabh" label="未获取到备案合同号" :transprent="true"></zh-form-desc>
				</view>
				<zh-sheet :round="3" v-else  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您在东阳无购房合同信息，如有疑问，可提供材料给报名学校添加"></zh-text>
				</zh-sheet>
			</template>
		</zh-card>
		<zh-card :width="620" v-if="data.sbFlag">
			<template v-slot:title>
				<view style="border-left: 10rpx solid #2f54eb;">
					<zh-text  :fontSize="36" class="text-weight-b pl-10" label="社保信息"></zh-text>
				</view >
			</template>
			<template v-slot:status>
				<zh-tag v-if="form.cbList&&form.cbList.length>1" size="n" label="切换" @click="onChangeSb" ></zh-tag>
			</template>
			<template v-slot:content>
				<view v-if="form.cbList&&form.cbList.length>0">
					<zh-form-desc  field="aac003"   v-model="form.cbList[data.sbIndex].aac003" label="参保人"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="aab004"   v-model="form.cbList[data.sbIndex].aab004" label="参保单位"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="aae140Name"   v-model="form.cbList[data.sbIndex].aae140Name" label="参保险种"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="aab301Name"  v-model="form.cbList[data.sbIndex].aab301Name" label="参保地"   :transprent="true"></zh-form-desc>
				</view>
				<zh-sheet :round="3" v-else  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您在东阳未正常参保缴费或者报名前未连续缴纳6个月职工养老保险"></zh-text>
				</zh-sheet>
			</template>
		</zh-card>
		<zh-card :width="620" v-if="data.jzzFlag">
			<template v-slot:title>
				<view style="border-left: 10rpx solid #2f54eb;">
					<zh-text  :fontSize="36" class="text-weight-b pl-10" label="居住证信息"></zh-text>
				</view >
			</template>
			<template v-slot:status>
				<zh-tag v-if="form.jzzList&&form.jzzList.length>1" size="n" label="切换" @click="onChangeJzz" ></zh-tag>
			</template>
			<template v-slot:content>
				<view v-if="form.jzzList&&form.jzzList.length>0">
				<zh-form-desc  field="xm"   v-model="form.jzzList[data.jzzIndex].xm" label="姓名"   :transprent="true"></zh-form-desc>
				<zh-form-desc  field="xzqhmc" placeholder="未获取到所属区划"  v-model="form.jzzList[data.jzzIndex].xzqhmc" label="所属区划"   :transprent="true"></zh-form-desc>
				<zh-form-desc  field="jzdz" placeholder="未获取到居住地址"  v-model="form.jzzList[data.jzzIndex].jzdz" label="居住地址"   :transprent="true"></zh-form-desc>
				<zh-form-desc  field="qzrq" placeholder="未获取到签注日期"  v-model="form.jzzList[data.jzzIndex].qzrq" label="签注日期"   :transprent="true"></zh-form-desc>
				<zh-form-desc  field="qzdqrq" placeholder="未获取到签注到期日期"  v-model="form.jzzList[data.jzzIndex].qzdqrq" label="签注到期日期" :transprent="true"></zh-form-desc>
				<zh-form-item :margin="[0,0]"  label="证件状态" field="zjzt" >
					<view style="width:100%" class="flex-row-center-end">
						<zh-tag  :shadow="0" :color="form.jzzList[data.jzzIndex].zjztdm==='2'?'green':'red'" text size="n" :label="form.jzzList[data.jzzIndex].zjzt">
						</zh-tag>
					</view>
				</zh-form-item>
				</view>
				<zh-sheet :round="3" v-else  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您在东阳无有效的《浙江省居住证》信息"></zh-text>
				</zh-sheet>
			</template>
		</zh-card>
		<zh-card :width="620" v-if="data.qyFlag">
			<template v-slot:title>
				<view style="border-left: 10rpx solid #2f54eb;">
					<zh-text  :fontSize="36" class="text-weight-b pl-10" label="企业(营业执照)信息"></zh-text>
				</view >
			</template>
			<template v-slot:status>
				<zh-tag v-if="form.qyList&&form.qyList.length>1" size="n" label="切换" @click="onChangeQy" ></zh-tag>
			</template>
			<template v-slot:content>
				<view v-if="form.qyList&&form.qyList.length>0">
					<zh-form-desc  field="tyxydm"  v-model="form.qyList[data.qyIndex].tyxydm" label="统一社会信用代码"   :transprent="true"></zh-form-desc>
					<zh-form-desc  field="frdwmc"   v-model="form.qyList[data.qyIndex].frdwmc" label="公司名称"   :transprent="true"></zh-form-desc>
				</view>
				<zh-sheet :round="3" v-else  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您在东阳无企业信息，如有疑问，可提供材料给报名学校添加"></zh-text>
				</zh-sheet>
			</template>
		</zh-card>
		<zh-card :width="620" v-if="data.xjFlag">
			<template v-slot:title>
				<view style="border-left: 10rpx solid #2f54eb;">
					<zh-text  :fontSize="36" class="text-weight-b pl-10" label="学籍信息"></zh-text>
				</view >
			</template>
			<template v-slot:content>
				<zh-form-desc v-if="form.studentStatusVO&&form.studentStatusVO.schoolName" field="schoolName"  v-model="form.studentStatusVO.schoolName" label="毕业学校"  :transprent="true"></zh-form-desc>
				<zh-sheet :round="3" v-else  :margin="[0, 0]" :padding="[20,20]" color="deep-orange" text>
					<zh-text  label="您的孩子在东阳无小学学籍信息"></zh-text>
				</zh-sheet>
			</template>
		</zh-card>
	</view>
	</view>
</template>

<script lang="ts" setup>
	//报名学校信息
	import {reactive,watch,ref,onMounted} from "vue";
	// ------------------接收传入参数(组件)-------------------
	const props = defineProps({
		modelValue: {
		  type: Object,
		  default: () => {
			return {
				
			}
		  }
		},
		//学校id
		schoolId:{
		  type: String,
		  default: '',
		},
		// 预报名id
		beforeId:{
		  type: String,
		  default: 0,
		},
	})
	const emits = defineEmits([
	  "update:modelValue",
	]);
	//---------------内部变量--------------------
	const form=ref<any>(props.modelValue)
	const data = reactive<any>({
		dictData:{} as any,//数据字典
		schoolInfo:{} as any,//报名学校信息
		configTypeDict:[],//报名大类
		showForm:false,//是否显示选择报名类别
		showFlag:false,//是否显示报名动态表单信息
		selectFormDictData:[] as any,//报名类别
		fieldList:[] as any,//动态字段信息
		specialFlag:'0', //是否特殊通道
		appointFlag:'0',//是否城区E类人员 0 否 1 是
		privateAppointFlag:'0',//是否民办直升班 0 否 1 是
		beforeInfo:{configName:''} as any,//一键报名信息
		xjFlag:false,//是否显示学籍
		hjFlag:false,//是否显示户籍
		fcFlag:false,//是否显示房产
		fcDsjFlag:false,//是否显示大数据房产
		fcIndex:0,//当前看到的一键报名比对房产数据序号
		fcDsjIndex:0,//当前看到的大数据房产数据序号
		jzzFlag:false,//是否显示居住证
		jzzIndex:0,//当前看到的居住证数据序号
		wqFlag:false,//是否显示网签
		wqIndex:0,//当前看到的网签合同数据序号
		sbFlag:false,//是否显示社保
		sbIndex:0,//当前看到的社保数据序号
		qyFlag:false,//是否显示企业
		qyIndex:0,//当前看到的企业数据序号
		houseInfo:{} as any,//房产信息		
		getSchoolFlag:false,//是否获取学校
		beforeList:[] as any,//预报名信息，多条
	})
	//------------------初始化------------------------------
	onMounted(()=>{
	  getDict()
      data.fcIndex=0
	  getBeforeInfo()
	})
	//-----------------------内部方法--------------------------------
	const getDict = () => {
		const params = {
			dictFields: 'cardType',
		};
		$api.common.getBatchDict.post(params).then((res: any) => {
			data.dictData = res.result;
		});
	};
	//获取一键报名情况
	const getBeforeInfo=()=>{
		data.appointFlag=form.value.appointFlag
		data.privateAppointFlag=form.value.privateAppointFlag
		let enrollBeforeList=form.value.enrollBeforeList||[]
		if(props.beforeId){
			let list=enrollBeforeList.filter((item:any)  => ((item.enrollBeforeId+'')===props.beforeId))
			if(list&&list.length>0){
				data.beforeInfo=list[0]
				data.specialFlag=list[0].specialFlag
				form.value.enrollBeforeId=list[0].enrollBeforeId
				form.value.specialFlag=list[0].specialFlag
			}
			data.beforeList=list
		}else{
			//不是一键报名的，判断学校是否有一键报名数据，有的话按一键报名处理
			let list=enrollBeforeList.filter((item:any)  => item.schoolId===props.schoolId&&item.specialFlag==='0')
			if(list&&list.length>0){
				data.beforeInfo=list[data.fcIndex]
				data.specialFlag=list[data.fcIndex].specialFlag
				form.value.enrollBeforeId=list[data.fcIndex].enrollBeforeId
				form.value.specialFlag=list[data.fcIndex].specialFlag
			}
			data.beforeList=list
		}
		if(data.beforeInfo&&data.beforeInfo.enrollBeforeId){
			//获取房产信息
			if(data.beforeInfo.houseId){
				if(data.specialFlag!=='1'){
					if(form.value.houseList&&form.value.houseList.length>0){
						let houseList=form.value.houseList.filter((item:any)  => item.houseId===data.beforeInfo.houseId)
						if(houseList&&houseList.length>0){
							data.houseInfo=houseList[0]
							form.value.houseId=data.beforeInfo.houseId
						}
					}
				}else{
					if(form.value.houseTstdList&&form.value.houseTstdList.length>0){
						let houseList=form.value.houseTstdList.filter((item:any)  => item.houseId===data.beforeInfo.houseId)
						
						if(houseList&&houseList.length>0){
							data.houseInfo=houseList[0]
							form.value.houseId=data.beforeInfo.houseId
						}
					}
				}
				
			}
			form.value.householdId=data.beforeInfo.householdId
		}else{
			if(form.value.houseList&&form.value.houseList.length>0){
				data.houseInfo=form.value.houseList[0]
				form.value.houseDsjId=form.value.houseList[0].houseId
			}
		}
		
		if(form.value.studentEnrollPreId){
			getSchoolInfo()
		}
		if(form.value.wqList&&form.value.wqList.length>0){
			form.value.netsignIdDsj=form.value.wqList[0].netsignId
		}
		if(form.value.cbList&&form.value.cbList.length>0){
			form.value.socialSecurityIdDsj=form.value.cbList[0].socialSecurityId
		}
		if(form.value.jzzList&&form.value.jzzList.length>0){
			form.value.livePlaceIdDsj=form.value.jzzList[0].livePlaceId
		}
		if(form.value.qyList&&form.value.qyList.length>0){
			form.value.companyIdDsj=form.value.qyList[0].companyId
		}
		
	}
	//获取报名学校情况
	const getSchoolInfo=()=>{
		if(data.getSchoolFlag){
			return
		}
		data.getSchoolFlag=true
		form.value.schoolId=props.schoolId
		$api.common.send.post("eduschool0002",{orgId:props.schoolId}).then((res:any)=>{
			data.schoolInfo=Object.assign({},res.result||{})
			form.value.schoolName=data.schoolInfo.schoolName
			form.value.schoolNature=data.schoolInfo.schoolNature
			//设置学段
			let list=[]
			if(data.specialFlag==='1'){
				list=data.schoolInfo.configSpecialList||[]
			}else{
				form.value.showMzgFlag=true
				form.value.showMbFlag=true
				let configList=data.schoolInfo.configList||[]
				if(configList&&configList.length>0){
					list=configList.filter((item:any)  => item.enrollStatus==='on')
				}
				
			}
			if(list.length>0){
				data.showForm=true
				data.configTypeDict=list;
				if(list.length===1){
					form.value.configTypeName=list[0].configTypeName
				}else{
					if(data.beforeInfo&&data.beforeInfo.configTypeName){
						form.value.configTypeName=data.beforeInfo.configTypeName
					}
				}
				setForm()
			}else{
				data.showForm=false
			}
			
		}).catch(() => {
			data.getSchoolFlag=false
		})
	}
	const configTypeChange=()=>{
		//报名学段变动
		form.value.formId=''
		setForm()
	}
	const setForm=()=>{
		//设置报名表单
		if(!form.value.configTypeName){
			data.selectFormDictData=[]
			return
		}
		let list=[]
		if(data.specialFlag==='1'){
			let formList=data.schoolInfo.formSpecialList;
			if(formList&&formList.length>0){
				list=formList.filter((item :any) => {
					let flag=item.configTypeName===form.value.configTypeName||!item.configTypeName
					if(data.beforeInfo.configName){
						if(item.configName!==data.beforeInfo.configName){
							flag=false
						}
					}
					return flag
				})
				
				
			}
		}else{
			let formList=data.schoolInfo.formList;
			if(formList&&formList.length>0){
				list=formList.filter((item:any) => {
					let flag=(item.configTypeName===form.value.configTypeName||!item.configTypeName)
					if(data.beforeInfo.configName&&data.beforeInfo.configName!=='E'){
						if(item.configName!==data.beforeInfo.configName){
							flag=false
						}
					}else{
						if(item.configName==='A'){
							flag=false
						}else if(item.configName==='B'){
							flag=false
						}else if(item.configName==='C'){
							flag=false
						}else if(item.configName==='特殊户口'){
							flag=false
						}
					}
					return flag
				})
			}
		}
		list.forEach((el:any) => {
			if(!el.formName){
				el.formName=el.configName
			}
		})
		data.selectFormDictData=list||[]
		if(form.value.showMzgFlag){
			//只有ABC特殊户口和特殊通道才能显示可选择报名民转公
			if(data.specialFlag!=='1'){
				let enrollBeforeList=form.value.enrollBeforeList||[]
				let list=enrollBeforeList.filter((item:any)  => item.configName==='A'||item.configName==='B'||item.configName==='C'||item.configName==='特殊户口')
				if(list.length<=0){
					form.value.showMzgFlag=false
				}
			}
		}
		if(list.length===1){
			form.value.formId=list[0].formId
			form.value.configName=list[0].configName
			form.value.formType=list[0].formType
			form.value.orderNo=list[0].orderNo
			form.value.formName=list[0].formName
			if(data.specialFlag==='1'){
				if(list[0].mbFlag==='1'){
					form.value.showMbFlag=true
				}else{
					form.value.showMbFlag=false
					//除缓学外判断是否满足最低条件,满足最低条件则可报名
					if(form.value.configName!=='缓学复读'){
						if(form.value.canEnrollFlag){
							form.value.showMbFlag=true
						}
					}
				}
				if(list[0].mzgFlag==='1'){
					form.value.showMzgFlag=true
				}else{
					form.value.showMzgFlag=false
					//除缓学外判断是否满足最低条件，满足最低条件则可报名
					if(form.value.configName!=='缓学复读'){
						if(form.value.canEnrollFlag){
							form.value.showMzgFlag=true
						}
					}
				}
			}
			
			setFormField()
		}
		
	
	
	}
	const formChange=(val:string,selectList :any)=>{
		//报名类别变化
		form.value.configName=selectList[0].configName
		form.value.formType=selectList[0].formType
		form.value.orderNo=selectList[0].orderNo
		setFormField()
	}
	const setFormField=()=>{
		//设置报名表单字段
    data.xjFlag=false
    data.hjFlag=false
    data.fcFlag=false
	data.fcDsjFlag=false
    data.wqFlag=false
    data.sbFlag=false
    data.qyFlag=false
    data.jzzFlag=false
		if(!form.value.formId){
			data.fieldList=[]
			data.showFlag=false
			return
		}
		data.showFlag=true
		if(form.value.configName==='A'){
			data.hjFlag=true
			data.fcFlag=true
		}else if(form.value.configName==='B'){
			data.hjFlag=true
			data.fcFlag=true
			data.houseInfo={}
		}else if(form.value.configName==='C'){
			data.hjFlag=true
			data.fcFlag=true
			form.value.houseHoldVO={}
		}else if(form.value.configName==='特殊户口'){
			data.hjFlag=true
			data.fcFlag=true
			data.houseInfo={}
		}else if(form.value.configName==='E'){
			if(data.schoolInfo.appointFlag){
				data.xjFlag=true
				data.houseInfo={}
				form.value.houseHoldVO={}
			}
			
		}else if(form.value.configTypeName==='特殊房产'){
			data.fcFlag=true
		}
		let fieldList=[]
		if(data.specialFlag==='1'){
			fieldList=data.schoolInfo.formSpecialParams?data.schoolInfo.formSpecialParams[form.value.formId]||[]:[];
		}else{
			fieldList=data.schoolInfo.formParams?data.schoolInfo.formParams[form.value.formId]||[]:[];
		}
		let inputFieldList=[] as any
		fieldList.forEach((el:any) => {
			if(el.propertyType==='4'){
				//大数据学籍
				data.xjFlag=true
			}else if(el.propertyType==='5'){
				//大数据户籍
				data.hjFlag=true
			}else if(el.propertyType==='6'){
				//大数据房产
				data.fcDsjFlag=true
			}else if(el.propertyType==='7'){
				//大数据网签
				data.wqFlag=true
			}else if(el.propertyType==='8'){
				//大数据社保
				data.sbFlag=true
			}else if(el.propertyType==='9'){
				//大数据营业执照
				data.qyFlag=true
			}else if(el.propertyType==='10'){
				//大数据居住证
				data.jzzFlag=true
			}else{
				if(el.defaultPhotos){
					el.defaultPhotoList=el.defaultPhotos.split(',')
				}
				inputFieldList.push(el)
			}
			
		})
		data.fieldList=inputFieldList
		form.value.fieldList=fieldList
	}
	const toHump=(name:String)=> {
		return name.replace(/\_(\w)/g, function(all, letter) {
			return letter.toUpperCase();
		});
	}
	const getUploadCount=(item:any)=>{
		if(item&&item.value){
			return item.value.split(',').length
		}else{
			return 0
		}
	}
	//切换网签合同
	const onChangeWq=()=>{
		if(data.wqIndex===(form.value.wqList.length-1)){
			data.wqIndex=0
		}else{
			data.wqIndex=data.wqIndex+1
		}
		form.value.netsignIdDsj=form.value.wqList[data.wqIndex].netsignId
	}
	//切换企业
	const onChangeQy=()=>{
		if(data.qyIndex===(form.value.qyList.length-1)){
			data.qyIndex=0
		}else{
			data.qyIndex=data.qyIndex+1
		}
		form.value.companyIdDsj=form.value.qyList[data.qyIndex].companyId
	}
	const onChangeSb=()=>{
		if(data.sbIndex===(form.value.cbList.length-1)){
			data.sbIndex=0
		}else{
			data.sbIndex=data.sbIndex+1
		}
		form.value.socialSecurityIdDsj=form.value.cbList[data.sbIndex].socialSecurityId
	}
	const onChangeJzz=()=>{
		if(data.jzzIndex===(form.value.jzzList.length-1)){
			data.jzzIndex=0
		}else{
			data.jzzIndex=data.jzzIndex+1
		}
		form.value.livePlaceIdDsj=form.value.jzzList[data.jzzIndex].livePlaceId
	}
	const onChangeFcDsj=()=>{
		if(data.fcDsjIndex===(form.value.houseList.length-1)){
			data.fcDsjIndex=0
		}else{
			data.fcDsjIndex=data.fcDsjIndex+1
		}
		data.houseInfo=form.value.houseList[data.fcDsjIndex]
		form.value.houseDsjId=form.value.houseList[data.fcDsjIndex].houseId
	}
	const getColor=()=>{
		if(data.specialFlag==='1'){
			return '#4ec752'
		}
		if(form.value.configName==="A"){
			return '#9C27B0'
		}else if(form.value.configName==="B"){
			return '#ffa114'
		}else if(form.value.configName==="C"){
			return '#3B5CF0'
		}else if(form.value.configName==="特殊户口"){
			return '#607D8B'
		}else{
			return '#795548'
			
		}
	}
	const onChangeFc=()=>{
		//切换房产
		if(data.fcIndex===(data.beforeList.length-1)){
			data.fcIndex=0
		}else{
			data.fcIndex=data.fcIndex+1
		}
		data.beforeInfo=data.beforeList[data.fcIndex]
		data.specialFlag=data.beforeList[data.fcIndex].specialFlag
		form.value.enrollBeforeId=data.beforeList[data.fcIndex].enrollBeforeId
		form.value.specialFlag=data.beforeList[data.fcIndex].specialFlag
		//获取房产信息
    	data.houseInfo={}
		if(data.beforeInfo.houseId){
			if(form.value.houseList&&form.value.houseList.length>0){
				let houseList=form.value.houseList.filter((item:any)  => item.houseId===data.beforeInfo.houseId)
				if(houseList&&houseList.length>0){
					data.houseInfo=Object.assign({},houseList[0]) 
					form.value.houseId=data.beforeInfo.houseId
				}
			}
		}
	}
	watch(
	  () => props.modelValue,
	  () => {
	   form.value=props.modelValue
	   getBeforeInfo()
	  },
	  {
	    deep:true
	  }
	  
	)
	
	watch(
		() => form.value,
		() => {
			//父组件发送数据
			emits("update:modelValue", form.value);
		},
		{
			deep: true,
		}
	);
</script>

<style>
</style>